<template>
	<view class="cashout_page">
		<view class="money_box">
			<view class="text">提现金额</view>
			<view class="ipt_box">
				<u-input class="ipt" prefixIcon="rmb" v-model="cash_value" placeholderStyle="font-size:32rpx" placeholder="请输入提现金额">
					<template slot="suffix">
						<view style="color: #00CC7B;" @click="allIn()">全部</view>
					</template>
				</u-input>
			</view>
			<view class="yue">当前余额{{user_info.money}}元</view>
		</view>
		<view class="binding_box">
			<view class="item">
				<image class="icon" src="../../static/wallet/ali.png"></image>
				<view class="among">
					<view>提现至支付宝</view>
					<view>
						<span style="color: #999999;font-size: 24rpx;margin-right: 16rpx;">{{cash_list.alipay_account?'已绑定':'未绑定'}}</span>
						<span style="color: #333333;font-size: 24rpx;" v-show="cash_list.alipay_account" @click="toAccount(1)">更换绑定</span>
					</view>
				</view>
				<view class="null_box" v-if="cash_list.alipay_account" @click="select=1">
					<view v-if="select!=1" class="null"></view>
					<image v-else src="../../static/index/select.png"></image>
				</view>
				<view v-else class="binding" @click="toBinding(1)">去绑定</view>
			</view>
			<view class="item">
				<image class="icon" src="../../static/wallet/wx.png"></image>
				<view class="among">
					<view>提现至微信</view>
					<view>
						<span style="color: #999999;font-size: 24rpx;margin-right: 16rpx;">{{cash_list.wechat_account?'已绑定':'未绑定'}}</span>
						<span style="color: #333333;font-size: 24rpx;" v-show="cash_list.wechat_account" @click="toAccount(2)">更换绑定</span>
					</view>
				</view>
				<view class="null_box" v-if="cash_list.wechat_account" @click="select=2">
					<view v-if="select!=2" class="null"></view>
					<image v-else src="../../static/index/select.png"></image>
				</view>
				<view v-else class="binding" @click="toBinding(2)">去绑定</view>
			</view>
		</view>
		<view class="btn">确认提现</view>
	</view>
</template>

<script>
	import {cashOut,userInfo} from "../../api/index.js"
	export default {
		data() {
			return {
				select:1,
				cash_value:'',
				ali_cash:true,
				wx_cash:false,
				user_info:[],
				cash_list:[]
			}
		},
		onShow() {
			this.getInfo()
			this.getCashOut()
		},
		methods: {
			getInfo(){
				userInfo().then(res=>{
					this.user_info=res.data
					console.log(res);
				})
			},
			getCashOut(){
				cashOut().then(res=>{
					console.log(res);
				})
			},
			allIn(){
				this.cash_value=this.user_info.money
				console.log(123);
			},
			toAccount(e){
				uni.navigateTo({
					url:"/pages/wallet/account/changebd?type="+e
				})
			},
			toBinding(e){
				uni.navigateTo({
					url:"/pages/wallet/account/account"
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.cashout_page {
		width: 100%;
		height: 95vh;
		padding: 32rpx;
		background-color: #F9F9F9;

		.money_box {
			width: 100%;
			height: 252rpx;
			background-color: #FFFFFF;
			border-radius: 8rpx;
			padding: 32rpx;
			.text {
				color: #333333;
				font-size: 28rpx;
			}

			.ipt_box {
				width: 100%;
				height: 112rpx;

				.ipt {
					width: 100%;
					height: 112rpx;
					border: none;
					border-bottom: 2rpx #FAFAFA solid;
				}
			}
			.yue{
				color: #999999;
				font-size: 24rpx;
				margin-top: 16rpx;
			}
		}
	
	    .binding_box{
			width: 100%;
			height: 248rpx;
			background-color: #FFFFFF;
			border-radius: 8rpx;
			margin-top: 32rpx;
			.item{
				width: 100%;
				height: 124rpx;
				padding: 20rpx 32rpx;
				display: flex;
				.icon{
					width: 48rpx;
					height: 48rpx;
					margin-top: 20rpx;
				}
				.among{
					width: 70%;
					height: 100%;
					margin-left: 32rpx;
				}
				.null_box{
					width: 40rpx;
					height: 40rpx;
					margin-top: 20rpx;
					margin-left: 56rpx;
					.null{
						width: 100%;
						height: 100%;
						border: 2rpx #DDDDDD solid;
						border-radius: 100%;
					}
					image{
						width: 100%;
						height: 100%;
					}
				}
				.binding{
					width: 100rpx;
					height: 48rpx;
					text-align: center;
					font-size: 24rpx;
					line-height: 40rpx;
					border-radius: 4rpx;
					border: 2rpx #00CC7B solid;
					color: #00CC7B;
					margin-top: 20rpx;
				}
			}
		}
	
	    .btn{
			width: 100%;
			height: 88rpx;
			line-height: 88rpx;
			text-align: center;
			color: #FFFFFF;
			font-size: 32rpx;
			border-radius: 74rpx;
			background-color: #00CC7B;
			margin-top: 96rpx;
		}
	}
</style>